// Kademlia 协议包括四种远程 RPC 操作：PING、STORE、FIND_NODE、FIND_VALUE。
namespace java cool.taomu.toolkit.service.centre.kademlia.thrift

//将功能细化

struct Node{
	1:string host,
	2:i32 port,
}

struct Response{
	1:binary data;
	2:i32 status;
	3:string message;
}

struct ServiceEntity{
	1: string serviceName,
    2: string method,
    3: string contentType,
    4: map<string, list<string>> params,
    5: map<string, string> headers,
    6: string body,
    7: list<string> cookie
}

service KademliaService {
	Response ping(1:Node node)
	Response findNode(1:string findNodeId,2: list<string> excludeIds)
	Response findValue(1:string key)
	void store(1:string key,2:string value)
	//service Center
	Response findServiceNode(1:ServiceEntity message,2: list<string> excludeIds)
    Response findService(1:ServiceEntity message)
    //download service
    Response downloadFile(1:string filename, 2: i64 offset, 3: i64 length)
    Response getFileSize(1: string filename)
    Response getFileLastModifiedTime(1: string filename)
}
